Skip to content

JRMP2-1 Show product card#5

Open
SvetlanaTr wants to merge 44 commits intomainfrom
JRMP2-1_Show_product_card
Open

JRMP2-1 Show product card#5
SvetlanaTr wants to merge 44 commits intomainfrom
JRMP2-1_Show_product_card

Conversation

@SvetlanaTr
Copy link
Collaborator

We can see the product detail page

When you click on a product in the list of products, a modal window opens with detailed information about the product.
complete information includes:

  • name
  • Full description
  • price
  • photo
  • at the bottom of the model window there are two buttons "add product to cart" and "close".

"add product to cart" - while locked

"close" - closes the model window

Lana Trupkina and others added 30 commits April 25, 2021 22:45
…received items from a backend endpoint done.

Co-authored-by: Dmytro Khyzhniak <exORYON@users.noreply.github.com>
…Changed files from .js to .ts. Minor improvements in many places.
…-2_Add_product_list.

Added check for next page. Minor improvements.
Comment on lines +7 to +8
const defaultPort:number = parseInt(process.env.PORT || '');
const port:number = defaultPort || 5500;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const port:number = process.env.PORT || 5500;

Comment on lines +11 to +18
maxPage: number;
itemsPerPage: number;

constructor() {
this.itemsPerPage = 5;
this.maxPage = 0;
this.setMaxPage();
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not controller responsibility

result: [],
};

let list: object[] = (await this.getAllItems()).result;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object - bad type for interface. need right type

return response;
}

async getItems(req: string):Promise<ResponseObj> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(req: string) - it's not full request

};

let list: object[] = (await this.getAllItems()).result;
const page: number = parseInt(req);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a option -> + req

Comment on lines +69 to +73
if (this.pageIsNotValid(page)) {
return false;
} else {
return true;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as an option
return !this.pageIsNotValid(page);

view.showSpinner();
model.currentList = await model.getDataFromBE(model.currentPage);

if (model.currentList.length === 0 || model.currentList.length > model.itemsPerPage) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ( !model.currentList.length || model.currentList.length > model.itemsPerPage) {

}
}
nextPage(): void {
if (model.currentList.length > 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model.currentList.length

Comment on lines +21 to +23
if (list.length === 0) {
throw new Error('Error. Stock is empty');
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have length === 0), it's not error

"@typescript-eslint/parser": "4.22.1",
"eslint": "7.2.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-node": "^11.1.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants